package com.emep.changzhi.analyse.repository.aqi;

import com.emep.changzhi.analyse.entity.aqi.DataAqiInfo;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

/**
 * @author yangj
 * @version V1.0
 * @Description: DOTO
 * @date 2018/3/28  14:13
 */
public interface DataAqiInfoRepository extends JpaRepository<DataAqiInfo, String> {
    List<DataAqiInfo> findByAreaId(String areaId, Sort sort);

    List<DataAqiInfo> findByAreaIdAndPositionNameAndTimePointBetween(String areaName, String siteName, String save, String end);

    List<DataAqiInfo> findAll(Specification<DataAqiInfo> specification);


//    @Query(value = "SELECT * FROM area_moniter_aqi WHERE area_id=:areaCode ORDER BY `update` DESC limit 1",nativeQuery = true)
//    List<Object> getsum(@Param("areaCode")String areaCode);

//    @Query(value = "SELECT  SUM(co) AS 'co' FROM data_aqi_info WHERE time_point BETWEEN :startdate AND  :enddate ;",nativeQuery = true)
//    double getsum(@Param("startdate")String startdate, @Param("enddate")String enddate);


}

